home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #9
/
Amiga Plus CD - 2004 - No. 09.iso
/
amigaplus
/
tools
/
dev_libs
/
feelin040718
/
arexx
/
f_create.rexx
next >
Wrap
OS/2 REXX Batch file
|
2004-08-03
|
5KB
|
176 lines
/*
$VER: F_Create.rexx 2.00 (16.03.2003) written by Olivier LAVIALE (gofromiel@numericable.fr)
________________________________________________________________________
This tool was written in ARexx because it can be easily modified to fit
you personnal needs. But in most cases you will not change a bit of
code, using the opt_xx_xx will do enough (I hope ;-).
F_Create.rexx may use F_Update.rexx depending your kind of project. You
should have a look at F_Update.rexx too.
Enjoy !!
*/
opt_sc_exe = 'RESETOPTS IGNORE 73 NOICON NOVERSION NOSTACKCHECK COMMENTNEST ERRREXX STREQ STRMER GST=Include:F_ALL.GST'
opt_sl_exe = 'NOICONS NODEBUG SC SD QUIET '
opt_sl_lib = 'NOICONS NODEBUG SC SD QUIET ADDSYM LIB Feelin:Sources/F_LIB.lib LIB SC:LIB/sc.lib'
opt_sl_srv = 'NOICONS NODEBUG SC SD QUIET ADDSYM LIB LIB:sc.lib'
copyright = 'written by Olivier LAVIALE (gofromiel@numericable.fr)' /* Your name here */
SIGNAL ON FAILURE
IF ~Show('L','rexxsupport.library') THEN DO
IF ~AddLib('rexxsupport.library',0,-30) THEN DO
Raise('Unable to open rexxsupport.library')
END
END
PARSE ARG arg_kind arg1 arg2 arg3 arg4
IF arg_kind ~= '' THEN DO
IF DataType(arg_kind) = 'CHAR' THEN DO
UPPER arg_kind
ADDRESS COMMAND 'Avail >NIL: FLUSH'
IF arg_kind = 'EXE' THEN DO
IF arg1 = '' THEN Raise('(EXE) Source missing')
PARSE ARG arg_kind arg1 arg2
CreateEXE(arg1,arg2)
END
ELSE IF arg_kind = 'LIB' THEN DO
IF arg1 = '' THEN Raise('(LIB) Destination missing')
IF DataType(arg1) ~= 'CHAR' THEN Raise('(LIB) Destination not valid (' || arg1 || ')')
IF arg2 = '' THEN Raise('(LIB) Version missing')
IF DataType(arg2) ~= 'NUM' THEN Raise('(LIB) Version number not valid (' || arg2 || ')')
IF arg3 = '' THEN Raise('(LIB) Revision missing')
IF DataType(arg3) ~= 'NUM' THEN Raise('(LIB) Revision number not valid (' || arg3 || ')')
CreateLIB(arg1,arg2,arg3,arg4)
END
ELSE IF arg_kind = 'SRV' THEN DO
IF arg1 = '' THEN Raise('(SRV) Destination missing')
IF DataType(arg1) ~= 'CHAR' THEN Raise('(SRV) Destination not valid (' || arg1 || ')')
CreateSRV(arg1)
END
ELSE IF arg_kind = 'TST' THEN DO
Raise('Building Testing not implemented yet')
END
ELSE Raise('"' || arg_kind || '" is not a valid project. Expecting EXE, LIB or TST')
ADDRESS COMMAND 'Avail >NIL: FLUSH'
END
ELSE Raise('"' || arg_kind || '" is not a valid project. Expecting EXE, LIB or TST')
END
ELSE Raise('You MUST supply a kind of project (EXE,LIB,TST)')
EXIT
/***/
/*+*/CreateEXE: PROCEDURE EXPOSE opt_sc_exe opt_sl_exe
PARSE ARG src, list
IF Right(src,2) = '.c' THEN src = Left(src,Length(src) - 2)
IF Exists(src || '.c') THEN DO
ADDRESS COMMAND 'SC' opt_sc_exe src || '.c'
ADDRESS COMMAND 'SLink LIB:c.o' src || '.o' list 'TO' src 'LIB LIB:SC.lib' opt_sl_exe
ADDRESS COMMAND 'Delete >NIL:' src || '.o'
END
ELSE Raise('Source' src || '.c' 'does not exists')
RETURN 0
/***/
/*+*/CreateLIB: PROCEDURE EXPOSE opt_sl_lib copyright
PARSE ARG dest, vers, revi, obj_list
Say('
F_Create.rexx: Building library "' || dest || '"...
')
ADDRESS COMMAND 'F_Update.rexx LIB' dest vers revi
IF (Right(dest,3) = '.fc' | Right(dest,3) = '.fp') THEN DO
name = Translate(dest,' ',':/')
name = Word(name,Words(name))
temp = 'T:F_Create_' || Left(name,Length(name) - 3)
name = 'FC_' || Left(name,Length(name) - 3)
ADDRESS COMMAND 'Feelin:Tools/CreateCCLib NAME' name 'V=' || vers 'R=' || revi 'C="' || copyright || '" DST="' || temp || '.a"'
IF Exists(temp || '.a') THEN DO
ADDRESS COMMAND 'PhxAss QUIET' temp || '.a'
END
END
list = CreateLST(temp || '.o Project.o') obj_list
Say('
Library
' dest '
Version
' vers || '.' || revi)
Say('
Linking
' list)
ADDRESS COMMAND 'sLink FROM ' list 'TO' dest opt_sl_lib
ADDRESS COMMAND 'Delete QUIET' temp || '.?'
RETURN 0
/***/
/*+*/CreateSRV: PROCEDURE EXPOSE opt_sl_srv
PARSE ARG dest
Say('
F_Create.rexx: Building server "' || dest || '"...
')
ADDRESS COMMAND 'F_Update.rexx SRV' dest
list = CreateLST('lib:c.o Project.o')
Say('
Server
' dest)
Say('
Linking
' list)
ADDRESS COMMAND 'sLink FROM ' list 'TO' dest opt_sl_srv
RETURN 0
/***/
/*+*/CreateTST: PROCEDURE
Say('
F_Create.rexx: Building a Testing...
')
ADDRESS COMMAND 'F_Update.rexx TST Test'
list = CreateLST('LIB:c.o Project.o')
Say('
Testing
Test')
Say('
Linking
' list)
ADDRESS COMMAND 'sLink FROM ' list 'TO Test QUIET NOICONS NODEBUG ADDSYM LIB LIB:SC.lib'
RETURN 0
/***/
/*+*/CreateLST: PROCEDURE
PARSE ARG list
dirl = ShowDir('',FILE,' ')
DO i = 1 TO Words(dirl)
file = Word(dirl,i)
IF Right(file,2) = '.o' THEN
IF file ~= 'Project.o' THEN
IF file ~= 'library.o' THEN list = list file
END
RETURN list
/***/
/*** Handles ***************************************************************/
Raise: PROCEDURE
Say('
F_Create.Error
:' arg(1))
EXIT
Failure:
Raise(SIGL || ': ' || SourceLine(SIGL))